<div id="Header">
<?php
function gen_header($key_word) {
  echo '<form method="post" name="logout_form"><input type="hidden" name="logout"></input></form>';
  echo '<table class="page_top" width="100%"><tr><th align="left">'.$key_word.'</th><th align="right">';
  if(isset($_SESSION["logged"])){
    echo $_SESSION['name'].' | <a href="javascript:document.logout_form.submit();">注销</a>';
  } else {
    echo '<a href="login.php">登录</a>';
  }
  echo '</th></tr></table>';
}

if(isset($_POST['logout'])) {
  $_SESSION = array();
  session_destroy();
  echo "<script>location.href='.'</script>";
}

?>
</div>

